package at.socialconference.web.client.ui;

import java.util.HashMap;

import at.socialconference.inter.model.Conference;

import com.google.gwt.user.client.ui.ListBox;

public class ListBoxConferences extends ListBox {
	private HashMap<Integer, Conference> mapConferences = new HashMap<Integer, Conference>();
	public void addConference(Conference conference) {
		mapConferences.put(conference.getId(), conference);
		addItem(conference.getName(), conference.getId().toString());
	}
	public Conference getSelectedConference() {
		try {
			int id = Integer.parseInt(getValue(getSelectedIndex()));
			return mapConferences.get(id);
		} catch (Exception e) {
			return null;
		}
	}
}